package com.xiaotu.service.sw.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.xiaotu.dao.sw.SwContactMapper;
import com.xiaotu.model.SwContactModel;
import com.xiaotu.service.sw.SwContactService;
import com.xiaotu.vo.SwContactVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author zhangxiao
 * @create 2021-09-06 11:26
 */
@Service
@Transactional
public class SwContactServiceImpl implements SwContactService {

    @Autowired
    private SwContactMapper swContactMapper;

    @Override
    public SwContactVo getSwContactStyles() {
        List<SwContactModel> models = swContactMapper.selectAll();
        SwContactModel model = null;
        if (CollUtil.isNotEmpty(models))
            model = models.get(0);
        SwContactVo vo = new SwContactVo();
        BeanUtil.copyProperties(model, vo);
        return vo;
    }
}
